/****************************************************************************
	This file is part of Basqet.

	Basqet is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	Basqet is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
    along with Basqet.  If not, see <http://www.gnu.org/licenses/>.

****************************************************************************/

#include "absolutelayout.h"

AbsoluteLayout::AbsoluteLayout(QWidget *parent, QSize size) : QLayout(parent), m_Size(size)
{

}

AbsoluteLayout::~AbsoluteLayout()
{

	QLayoutItem* item;

	while(m_WidgetList.size() > 0)
	{
		item = m_WidgetList.takeFirst();
		delete item;

	}

}

int AbsoluteLayout::count() const
{
	return m_WidgetList.count();

}

QLayoutItem *AbsoluteLayout::itemAt(int idx) const
{
	// QList::value() performs index checking, and returns 0 if we are
	// outside the valid range
	return m_WidgetList.value(idx);
}

 QLayoutItem *AbsoluteLayout::takeAt(int idx)
 {
	 // QList::take does not do index checking
	 return idx >= 0 && idx < m_WidgetList.size() ? m_WidgetList.takeAt(idx) : 0;
 }

  void AbsoluteLayout::addItem(QLayoutItem *item)
 {
	 m_WidgetList.append(item);
 }


 void AbsoluteLayout::setGeometry(const QRect &r)
 {
	 m_Size = r.size();

	 QLayout::setGeometry(r);

	 return;

 }

 QSize AbsoluteLayout::sizeHint() const
 {
	 return m_Size;

 }

 QSize AbsoluteLayout::minimumSize() const
 {
	 return m_Size;

 }
